<template>
  <div>
    <div class="box_renqi">
      <h1 class="h1_renqi" @click="addrenqi">人气推荐 ></h1>
      <ul class="ul_renqi">
        <li
          v-for="(item, index) in renqilist"
          :key="index"
          v-show="index <= 12 && index >= 9"
          @click="editreqi(item)"
        >
          <img :src="item.pic" />
          <p>{{ item.name }}</p>
          <p>{{ item.characteristic }}</p>
          <p>￥{{ item.minPrice }}</p>
        </li>
      </ul>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      renqilist: [],
    };
  },
  mounted() {
    this.$APL.KANJIA().then((res) => {
      // console.log(res.data.data);
      this.renqilist = res.data.data;
    });
  },
  methods: {
    addrenqi(){
      this.$router.push({path:'/renqilist'})
    },

    editreqi(item){
        this.$router.push({path:"/renqidatil" , query:{id:item.id}})
    }
  },
};
</script>
<style lang="scss">
.box_renqi {
  width: 100%;
  margin-top: 0.3rem;
  background: white;
}
.ul_renqi {
  margin-top: 0.2rem;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-around;
  flex-wrap: wrap;
  li {
    width: 45%;
  }
  img {
    width: 100%;
    height: 4.5rem;
  }
  p {
      height: 0.4rem;
    &:nth-child(2) {
      white-space: nowrap;
      text-overflow: ellipsis;
      overflow: hidden;
    }
     &:nth-child(3) {
      white-space: nowrap;
      text-overflow: ellipsis;
      overflow: hidden;
      color: gainsboro;
    }
    &:nth-child(4){
        color: red;
    }
  }
}
.h1_renqi{
    font-size: 0.6rem;
    width: 100%;
    text-align: center;
}
</style>